<template>
	<div>
		<el-container>
			<el-main>
				<el-form>
					<el-row>
						<el-col :span="3">
							<el-form-item>
								<span style="font-size:medium;">患者信息查询: </span>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row>
						<el-col :span="4">
							<el-form-item>
								<span><a class="RedStar">*</a> 病历号: </span>
								<el-input v-model="returnReg.medicalNum" placeholder="病历号" style="width:50%"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="2">
							<el-button>搜索</el-button>
						</el-col>
					</el-row>
					<el-row>
						<el-col :span="2">
							<el-form-item>
								<span style="font-size:medium; padding-left: 15px;">患者信息: </span>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row>
						
						<el-col :span="2">
							<el-form-item style="text-align: right; padding-right: 20px;">
								<a class="RedStar">*</a> 姓 名 :
							</el-form-item>
						</el-col>
						<el-col :span="2" style="text-align: left;">
							<el-input placeholder="姓名"></el-input>
						</el-col>
						<el-col :span="3">
							<el-form-item style="text-align: right; padding-right: 20px;">
								身份证号 :
							</el-form-item>
						</el-col>
						<el-col :span="4" style="text-align: left;">
							<el-input placeholder=" 身份证号"></el-input>
						</el-col>
						<el-col :span="2" style="text-align: right; padding-right: 20px;">
							<el-form-item>
								住址:
							</el-form-item>
						</el-col>
						<el-col :span="2" style="text-align: left;">
							<el-input placeholder="住址"></el-input>
						</el-col>
					</el-row>
					<el-row>
						<el-col :span="3">
							<el-form-item>
								<span style="font-size:medium; ">患者处方信息: </span>
							</el-form-item>
						</el-col>
					</el-row>
						
					<el-row>
						
										
						<el-table ref="singleTable" :data="returnReg" @selection-change="handleSelectionChange"
								style="width: 100%;" highlight-current-row="true">
							
							
				
							<el-table-column type="selection" width="60"></el-table-column>
							
							<el-table-column prop="medicalNum" label="病历号">
							</el-table-column>
							<el-table-column prop="name" label="姓名">
							</el-table-column>
							<el-table-column prop="project" label="项目名称">
							</el-table-column>
							<el-table-column prop="fee" label="单价">
							</el-table-column>
							<el-table-column prop="number" label="数量">
							</el-table-column>
							<el-table-column prop="time" label="开立时间">
							</el-table-column>
							
							<el-table-column prop="Status" label="处方状态">
							</el-table-column>
						</el-table>
					</el-row>
					<el-row>
						<el-col :span="22" style="text-align:center;" >
							<el-button @click="getMethodFun()">退药</el-button>
						</el-col>
					</el-row>
				</el-form>
			</el-main>
		</el-container>
	</div>
</template>

<script>
	
	export default {
		mounted:function(){
			this.$axios.get('http://localhost:8080/Medicine.json').then((result) => {
				this.returnReg = result.data; //写法固定
			}).catch((err) => {
				console.log(err);
			})
		},
		data() {
			return {
				formInline: {
					user: '',
					region: ''
				},
				returnReg: {},
				multipleSelection:[]
				
			}
		},
		methods: {
			handleSelectionChange(val) {
				console.log(val);
				this.multipleSelection = val;
			},
			getMethodFun(){
				for (let s of this.multipleSelection) {

					for (let re of this.returnReg){
						if(s.medicalNum == re.medicalNum&&s.project == re.project){
							re.Status="已退药";
						}
					}
				}
				 
				
			}
			
		}
	}
</script>

<style>
	.RedStar {
		color: red;
	}

	.left {
		text-align: left;
	}
</style>
